// pages/shopList/index.js
Page({
  data: {
    systemCfg: '',
    totalMoney: 0
  },
  nextStep: function() {
    wx.navigateTo({
      url: "../order/index"
    })
  },
  onShow: function() {
    this.getSystemCfg()
  },
  getSystemCfg: function () {
    var cfg = wx.getStorageSync('cfg')
    var _this = this
    if (!cfg) {
      util.djax({
        url: '/wxapp/other/cfg'
      }).then(function (res) {
        cfg = res.data
        wx.setStorageSync('cfg', res.data)
      })
    }
    
    var cartList = wx.getStorageSync('wantBuy')
    var totalMoney = 0
    for (var i = 0; i < cartList.length; i++) {
        totalMoney += cartList[i].price * cartList[i].number
    }
    this.setData({
      systemCfg: cfg,
      totalMoney: totalMoney
    })
  }
})